#ifndef FKSERVEROBJECTMANAGER_H
#define FKSERVEROBJECTMANAGER_H

#include "FKAbstractObjectManager.h"

#include "FKApplication_global.h"

class QTcpServer;
class FKClientManager;

class FKAPPLICATIONSHARED_EXPORT FKServerObjectManager:public FKAbstractObjectManager{
    Q_OBJECT
public:
    FKServerObjectManager();
    ~FKServerObjectManager();
    bool startServer(int port);
private slots:
    virtual void internalEvent(FKEvent* event);
//    virtual void clientRequested(QString clientName, QString password);
    void newConnection();
    virtual void getClient(QString clientName, QString password, FKClientManager* s);
    void resetManager(FKClientManager* m);
private:
    virtual void sendMessage(QString message, FKClientManager *manager);
    virtual void returnMessage(qint32 clientID, QString text);
    QMap<qint32,FKClientManager*> _clients;
    QMap<FKClientManager*,qint32> _managers;
    QTcpServer* _server;
};

#endif // FKSERVEROBJECTMANAGER_H
